package com.daiqee.service.impl;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;

import com.daiqee.pojo.Employee;
import com.daiqee.pojo.EmployeeDepartment;
import com.daiqee.pojo.EmployeeRole;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.daiqee.dao.mapper.EmployeeDepartmentMapper;
import com.daiqee.dao.mapper.EmployeeMapper;
import com.daiqee.dao.mapper.EmployeeRoleMapper;

/**
 * 员工
 * 
 * <br/>
 * @since JDK 1.8
 * @version  V2.1
 * @author RichardTang 
 * @date: 2018年5月8日 上午8:22:35
 * @package com.daiqee.service.impl
 * @copyright:Copyright (c) 2018, 1245811923@qq.com All Rights Reserved.
 */
@Service
public class EmployeeService extends ServiceImpl<EmployeeMapper, Employee>{

	@Autowired
	private EmployeeMapper employeeMapper;
	
	@Autowired
	private EmployeeRoleMapper employeeRoleMapper;
	
	@Autowired
	private EmployeeDepartmentMapper employeeDepartmentMapper;
	
	/**
	 * 添加一条员工档案
	 * @Time 2018年4月3日16:40:17
	 * @since 2.1
	 * @version 2.1
	 * @author RichardTang
	 */
	public Boolean addStaffFiles(Employee employee) {
		//先添加员工到employee表
		employeeMapper.insert(employee);
		//添加职务(角色)
		employeeRoleMapper.insert(new EmployeeRole(employee.getEmpId(),employee.getEmpRole()));
		//添加部门
		employeeDepartmentMapper.insert(new EmployeeDepartment(employee.getEmpId(), employee.getEmpDepartment()));
		return true;
	}

}
